<?php
require 'global.php';
$url = $_GET['url'];
$rid = $_GET['rid'];
$kid = $_GET['kid'];
if (!$url) {
	echo "文件地址不正确";
	exit ;
}
$table = "bs_result" . $kid % 16;
$key = "'" . md5($table . $rid) . "'";
if ($mc -> get($key)) {
	//echo 'cache';
	echo '大小：' . searchFactory::sizecount($mc -> get($key));
	exit ;
}
$sf = new searchFactory($db, $mc);
$size = $sf -> get_size_from_mysql($db, $kid, $rid);
if ($size) {
	searchFactory::save_size($db, $kid, $rid, $size);
	//echo 'mysql';
	echo '大小：' . searchFactory::sizecount($size);
	exit ;
}
//开始抓取
$size = searchFactory::getFileSize($url);
//$size='1M';
if ($size != NULL) {
	searchFactory::save_size($db, $kid, $rid, $size);
	$sf -> add_cached($key, $size);
	//echo 'diyici';
	echo '大小：' . searchFactory::sizecount($size);
	exit ;

}else{
	
	$sf->del_null_size($kid, $rid);
	//$mc->delete();
	?>
	
	<script>
		
		$(function() {
			
			var table='#table<?php echo $rid;?>';
			
			$(table).hide();
			
		});
		
		
	</script>
	
	<?php
	exit;
	
	
}
?>

